var Ma_TestFaPaiWindow = Window.extend({
    _ccsFileName :res.Ma_TestFaPaiWindow,
    initWindow: function () {
        this._super();
    },
    _initClickListeners: function () {
        this._super();
        this._clickListeners = {
            'btn_faPai': '_clickFaPaiBtn'
        };
    },
    /**
     * 点击发牌按钮回调
     * @private
     */
    _clickFaPaiBtn: function () {
        var pos0InputStr = this._nodeList['pos0.input'].getString();
        var pos10InputStr = this._nodeList['pos1.input'].getString();
        var pos2InputStr = this._nodeList['pos2.input'].getString();
        var pos30InputStr = this._nodeList['pos3.input'].getString();
        var dipaiInputStr = this._nodeList['posdi.input'].getString();
        var laiziInputStr = this._nodeList['poslaizi.input'].getString();
        var piziInputStr = this._nodeList['pospizi.input'].getString();

        if (pos0InputStr == "" || pos0InputStr == null) {
            showAlert("pos0手牌为空");
            return;
        }
        if (pos10InputStr == "" || pos10InputStr == null) {
            showAlert("pos1手牌为空");
            return;
        }
        if (pos2InputStr == "" || pos2InputStr == null) {
            showAlert("pos2手牌为空");
            return;
        }
        if (pos30InputStr == "" || pos30InputStr == null) {
            showAlert("pos3手牌为空");
            return;
        }
        if (dipaiInputStr == "" || dipaiInputStr == null) {
            showAlert("底牌牌为空");
            return;
        }
        if (laiziInputStr == "" || laiziInputStr == null) {
            showAlert("癞子牌为空");
            return;
        }
        if (piziInputStr == "" || piziInputStr == null) {
            showAlert("皮子牌为空");
            return;
        }


        var data = {};
        data['paiArrs'] = [];
        for (var s = 0; s < 4; s++) {
            var strpos = this._nodeList['pos' + s + '.input'].getString();
            var strNumArr = [];
            var strArr = strpos.split(",");
            for (var i = 0; i < strArr.length; i++) strNumArr.push(parseInt(strArr[i]));
            data['paiArrs'].push({pos: s, paiArr: strNumArr});
        }

        var strArr = dipaiInputStr.split(",");
        var strNumArr = [];
        for (var i = 0; i < strArr.length; i++) strNumArr.push(parseInt(strArr[i]));
        data['unusedPaiArr'] = strNumArr;
        if (laiziInputStr != "" || laiziInputStr != null)
            data['laiziPaiId'] = laiziInputStr;

        if (piziInputStr != "" || piziInputStr != null)
            data['laiziPiPaiId'] = piziInputStr;


        data['room_id'] = gameData.roomId;
        // console.log('配牌器：' + JSON.stringify(data));
        network.send(MsgCode.TestPai, data);
        this.removeFromParent(true);
    }
})